package com.pro.service.imple;

import com.pro.dao.NavigationBarMapper;
import com.pro.entity.JsMenu;
import com.pro.entity.JsUser;
import com.pro.entity.LoginRecord;
import com.pro.entity.OrderQuantity;
import com.pro.service.NavigationBarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @ClassName NavigationBarData
 * @Author 谭金诚
 * @Date 2021/11/4
 */
@Service
public class NavigationBarServiceImple implements NavigationBarService {

    @Autowired
    private NavigationBarMapper mapper;


    @Override
    public List<JsMenu> getNavigationBarData(Integer parentId) {
        List<JsMenu> navigationBarData = mapper.getNavigationBarData(parentId);
        return navigationBarData;
    }

    @Override
    public JsUser getJsUser(Integer id) {
        JsUser jsUser = mapper.getJsUser(id);
        return jsUser;
    }

    @Override
    public List<LoginRecord> getLoginUser(Integer id) {
        List<LoginRecord> loginUser = mapper.getLoginUser(id);
        return loginUser;
    }

    @Override
    public List<Map<String, Object>> selNavigation() {
        List<Map<String , Object>> list = new ArrayList<>();
        return list;
    }

    @Override
    public OrderQuantity getOrderQuantityStatus(Integer id) {
        OrderQuantity orderQuantity = new OrderQuantity();
        Integer noPayment = mapper.getOrderQuantityStatus(id,2);
        Integer havePayment = mapper.getOrderQuantityStatus(id,3);
        Integer noSendGoods = mapper.getOrderQuantityStatus(id,4);
        Integer haveSendGoods = mapper.getOrderQuantityStatus(id,5);
        Integer haveSignFor = mapper.getOrderQuantityStatus(id,6);
        Integer returnRequest = mapper.getOrderQuantityStatus(id,7);
        Integer returning = mapper.getOrderQuantityStatus(id,8);
        Integer haveReturn = mapper.getOrderQuantityStatus(id,9);
        Integer cancelTransaction = mapper.getOrderQuantityStatus(id,10);

        orderQuantity.setNoPayment(noPayment);
        orderQuantity.setHavePayment(havePayment);
        orderQuantity.setNoSendGoods(noSendGoods);
        orderQuantity.setHaveSendGoods(haveSendGoods);
        orderQuantity.setHaveSignFor(haveSignFor);
        orderQuantity.setReturnRequest(returnRequest);
        orderQuantity.setReturning(returning);
        orderQuantity.setHaveReturn(haveReturn);
        orderQuantity.setCancelTransaction(cancelTransaction);

        Integer shipin = mapper.getShenHeNums(2);
        Integer shangpin = mapper.getShenHeNums(3);
        Integer weiquan = mapper.getShenHeNums(4);

        orderQuantity.setVideoNoNums(shipin);
        orderQuantity.setCommodityNoNums(shangpin);
        orderQuantity.setMicroCircleNoNums(weiquan);
        return orderQuantity;
    }

    @Override
    public List<Integer> getDeptAndUser(Integer userId) {
        List<Integer> deptAndUser = mapper.getDeptAndUser(userId);
        return deptAndUser;
    }

    @Override
    public List<JsMenu> getNav(Integer deptId) {
        List<JsMenu> nav = mapper.getNav(deptId);
        return nav;
    }

}
